<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tld/core.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/fn.tld" prefix="fn" %>
<%@page import="live.common.Format"%>
<%@page import="live.common.GetSequence"%>
<%@page import="live.jipiao.entity.RiseCabinChange"%>
<%@page import="live.pay.ServiceIds"%>
<%@page import="live.common.PostParam"%>
<%@page import="live.pay.SignUtil"%>
<%@page import="live.api.impl.PaySendReqRes"%>
<%@page import="live.jipiao.dao.RiseChangeManger"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

String userId=(String)session.getAttribute("ssoclientagent.user");
String req_trans_tm=Format.getInstance().dateFormatString(new Date(), "yyyyMMddHHmmss");
String req_trans_seq=GetSequence.returnSeqNum();
RiseCabinChange rcItem =  (RiseCabinChange) request.getAttribute("rise");
String subject_desc = RiseChangeManger.returnSubject_Desc(rcItem);
Map map = new TreeMap();
map.put("service_id",ServiceIds.PRE_AUTH_RES);
map.put("req_org_cd",PostParam.REQ_ORG_CD);
map.put("req_trans_tm",req_trans_tm);
map.put("req_trans_seq",req_trans_seq);
map.put("order_id",rcItem.getCabinNo());
map.put("seller_id",PostParam.FLIGHT_NAME);
map.put("sub_order_flag","N");
map.put("sub_order_num","0");
map.put("order_desc",subject_desc);
map.put("tot_trans_amt",((int)(rcItem.getBalance()*100))+"");
map.put("buyer_id",userId);
map.put("valid_date","0");
map.put("notify_url",PostParam.RISE_NOTIFY);
//map.put("return_url","");
String sign=SignUtil.sign(map,PostParam.PAYKEY);
map.put("sign",sign);
map.put("sign_type","MD5");
new PaySendReqRes().insertSendRequest(map);
%>

<!DOCTYPE html PUBliC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>我的订单-升舱订单</title>
<base href="<%=basePath %>"/>
<link href="orderManager/member/css/login.css" rel="stylesheet" type="text/css" />
<LINK href="orderManager/member/css/header-min.css" rel=stylesheet>
<script type="text/javascript" src="orderManager/member/css/sdmenu.js">	</script>
<script type="text/javascript" src="script/zDrag.js"></script>
<script type="text/javascript" src="script/zDialog.js"></script>
</head>

<body>

<jsp:include page="/pub_head.jsp"></jsp:include>
	<!-- 中间 -->
	<div id="page-container">
 
<form action="/flight/rise.do?op=orders" method="post" style="margin: 0px;">
	  <div id="content" style="border: solid 1px #0183BD;">
	  <div id="listbb">
	  <div align="center">
	   <!-- 原订单 -->
  	<table class="tablet" cellspacing="1" cellpadding="3" border="0" style="width: 98%">
  	<tr style="background-color: white;"><th colspan="10">机票订单信息</th></tr>
  		<tr>
  			<td>编码</td><td>${order.orderNo}</td>
  			<td>出发日期</td><td>
  			<bean:write name="order" property="sdate" format="yyyy-MM-dd"/></td>
  			<td>出发时间</td><td><bean:write name="order" property="depTime" format="HH:mm"/></td>
  			<td>航班号</td><td>${order.flightNo}</td>
  			<td>舱位</td><td>${order.cabinCode}</td>
  		</tr>
  	</table>
  <!-- 升舱信息 -->
  	<table class="tablet" cellspacing="1" cellpadding="3" border="0" style="width: 98%">
  	<tr style="background-color: white;"><th colspan="12">升舱信息</th></tr>
  		<tr>
  			<td>乘客</td><td>${rise.passengers }</td>
  			<td>编码</td><td>${rise.cabinNo }</td>
  			<td>出发日期</td><td><bean:write name="rise" property="flightDate" format="yyyy-MM-dd"/></td>
  			<td>出发时间</td><td><bean:write name="rise" property="flightDate" format="HH:mm"/></td>
  			<td>航班号</td><td>${rise.flightNo }</td>
  			<td>舱位</td><td>${rise.cabin}</td>
  		</tr>
  	</table>
  	<!-- 订单信息 -->
  	<table class="tablet" cellspacing="1" cellpadding="3" border="0" style="width: 98%">
  	<tr style="background-color: white;"><th colspan="4">订单信息</th></tr>
  		<tr><td>订单状态</td><td>
  		<c:if test="${fn:trim(rise.state)=='2'}">
                  <font style="color: RED; font-weight: bold;">同意升舱等待支付</font>
                  </c:if></td>
  		<td>申请时间</td><td>
  			<bean:write name="rise" property="createTime" format="yyyy-MM-dd HH:mm:ss"/></td></tr>
  		<tr><td>支付金额</td><td>${rise.balance }</td>
  		<td>同意时间</td><td><bean:write name="rise" property="updateTime" format="yyyy-MM-dd HH:mm:ss"/></td></tr>
  	</table><br/>
  	<button onclick="startpay()" class="paybtned">立即支付</button>
  	<div class="showDivStyle" id="showDiv"
			style="display: none; text-align: left;">
			<ul>
				<li style="color: black;">
					<h2>
						请在弹出的页面内进行支付。
					</h2>
				</li>
				<li style="color: black;">
					<b>付款成功：</b><a href="/flight/rise.do?op=orders">查看升舱记录</a>
				</li>
				<li style="color: black; display: none">
					<b>付款失败：</b>查看支付帮助
					</span>
				</li>
			</ul>
			<div class="btndiv">
			</div>
		</div>
      </div>
	</div>
	</div>
</form>
<form name="pform" action="<%=PostParam.PAY_API%>" method="post" target="_blank">
			<input type="hidden" name="service_id" value="<%=ServiceIds.PRE_AUTH_RES%>" />
			<input type="hidden" name="req_org_cd" value="<%=PostParam.REQ_ORG_CD %>" />
			<input type="hidden" name="req_trans_tm" value="<%=req_trans_tm%>" />
			<input type="hidden" name="req_trans_seq" value="<%=req_trans_seq%>" />
			<input type="hidden" name="order_id" value="${rise.cabinNo}" />
			<input type="hidden" name="seller_id" value="<%=PostParam.FLIGHT_NAME %>" />
			<input type="hidden" name="sub_order_flag" value="N" />
			<input type="hidden" name="sub_order_num" value="0" />
			<input type="hidden" name="order_desc" value="<%=subject_desc %>" />
			<input type="hidden" name="tot_trans_amt" value="<%=map.get("tot_trans_amt")%>" />
			<input type="hidden" name="buyer_id" value="<%=userId %>" />
			<input type="hidden" name="valid_date" value="0" />
			<input type="hidden" name="notify_url" value="<%=PostParam.RISE_NOTIFY%>" />
			<input type="hidden" name="sign" value="<%=sign%>" />
			<input type="hidden" name="sign_type" value="MD5" />
		</form>
<input id="second" type="hidden" value="1" />
	<script type="text/javascript" defer="defer"> 

function startpay(){
var tt=$("#second").val();
if(tt==1){
	ShowDivWin('正在支付',250,120,'showDiv');
	$("#second").val(2);
	$(".paybtned").attr("disabled","true");
	$(".paybtned").unbind("click");
	document.forms['pform'].submit();
}
}
</script>
	
<iframe id="frmLeft" name="frmLeft" src="/orderManager/left_buy.jsp" width="154" height="650" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="yes"></iframe>
 
	
</div>
	<!-- 脚部 http://www.zemoitu.com/footer.jsp<iframe id="frmFoot" name="frmFoot" src="/footer.jsp" width="950" height="280" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="yes"></iframe>--> 
 
<div id="page-container">
<%@include file="/footer.jsp" %>
</div>




</body>
</html>
